﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Bunian.Core.BusinessObjects"
                   assembly="Bunian.Core">

  <class name="Tender" table="BeneficiaryTenders" lazy="true">

    <id name="Id" column="BeneficiaryTenderId" unsaved-value="0">
      <generator class="native"/>
    </id>

    <property name="Type" column="TenderTypeId" />
    <many-to-one name="Beneficiary" column="BeneficiaryId" class="IBeneficiary" lazy="no-proxy" />

    <bag name="Sponsorships" inverse="true" generic="true" cascade="all">
      <key column="BeneficiaryTenderId"/>
      <one-to-many class="Sponsorship" />
    </bag>
    
    <joined-subclass name="Orphan" table="Orphans">

      <key column="BeneficiaryTenderId" />

      <property name="TestingAdditionalInfo" column="TestingAdditionalInfo" type="System.String"/>

    </joined-subclass>

    <joined-subclass name="NeedyFamily" table="NeedyFamilies">

      <key column="BeneficiaryTenderId" />

    </joined-subclass>
    
  </class>
</hibernate-mapping>